/*
 * print.cpp
 *
 *  Created on: 28.10.2012
 *      Author: caffeine
 */




#include "print.h"
#include <xml/IFactoryEnvironment.h>
#include <xml/IFactoryRecord.h>
#include <xml/IXmlNode.h>
#include <log/Log.h>

class PrintFactoryRecord:public irr::xml::IFactoryRecord{
	virtual irr::xml::TagResult tagHandlerBefor(irr::xml::IFactoryEnvironment*environment,irr::xml::IXmlNode*node){
		LOG("XML: %s",node->getAttString("text").c_str());
		return irr::xml::BACK;
	}

	virtual irr::core::array<irr::core::stringc> getProcessedTags(){
		irr::core::array<irr::core::stringc> res;
		res.push_back("print");
		return res;
	};

	virtual irr::xml::TagResult tagHandlerAfter(irr::xml::IFactoryEnvironment*environment,irr::xml::IXmlNode*node){
		node->setParent(0);
		return irr::xml::BACK;
	}
};

void regPrint(irr::xml::IFactoryEnvironment*environment){
	PrintFactoryRecord*temp=new PrintFactoryRecord();
	environment->registerHandler(temp);
	temp->drop();
}
